﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class View_CIB_CIB006_1 : ViewMatrix //System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Title = "CIB聯貸案";
        criteriaList = new string[] { "Criteria", "GroupBy" };
        serviceName = "MISAPP.Classify.Service.Service_CIB006";
        btn2Excel.PageParameter = "method=GetSummaryData&xls=CIB006&service=Service_CIB006";

        if (!IsPostBack)
        {
            getData();
        }   
    }

    protected void getData()
    {
        string str = Session["GroupBy"].ToString();
        if (str.Equals("LNAC_NAME"))
        {
            str = "LNAC_ID";
        }
        string groupByList = string.Format("{0},{1}",
            str,"CUR");
        System.Data.DataTable dt = GetDataFromSerevice("GetSummaryData");
        //CLB_Summary.PageSize = GetGridViewPageSize();
        string[] lst = groupByList.Split(new Char[] { ',' });
        CLB_Summary.SetData(dt, lst);
    }

    protected void btn2Excel_Click(object sender,EventArgs e)
    {
        FillToSession(); 
    }

    protected void previous_click(object sender, EventArgs e)
    {
        Utility.SessionClear();
    }

    protected void CLB_Summary_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        //if (e.Row.RowType == DataControlRowType.DataRow)
        //{
        //    string urlString;
        //    /*
        //     * pageParameter = "method=GetDetailData&xls=CIB003_Detail&service=Service_CIB003";
        //strPage = string.Format("../GV2XLS.aspx?{0}", pageParameter);
        //Server.Transfer(strPage);
        //     */
        //    HyperLink link = new HyperLink();
        //}
    }

    protected void CLB_Summary_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName.Equals("detail"))
        {
            serviceName = "MISAPP.Classify.Service.Service_CIB006";
            criteriaList = new string[] { "Criteria", "key" };

            Session["key"] = CLB_Summary.SelectKeyValue;

            FillToSession();
            string strPage, pageParameter;
            pageParameter = "method=GetDetailData&xls=CIB006_Detail&service=Service_CIB006";
            strPage = string.Format("../GV2XLS.aspx?{0}", pageParameter);

            Server.Transfer(strPage);

        }
    }
}
